Skip to content

MkClassTable

Show source on GitHub

Node for a table showing info for a list of classes.

Example: Compact layout

Jinja

{{ [_mk.MkTable, _mk.MkClassTable, _mk.MkNav] | MkClassTable(layout="compact") }}

Python

MkClassTable([MkTable, MkClassTable, MkNav], layout='compact')
Class Module Description
MkTable mknodes.basenodes.mktable Class representing a formatted table.
MkClassTable mknodes.templatenodes.mkclasstable Node for a table showing info for a list of classes.
MkNav mknodes.navs.mknav Nav section, representing a nestable menu.
| Class | Module | Description |
|--- | --- | --- |
| [MkTable](https://phil65.github.io/mknodes/) | mknodes.basenodes.mktable | Class representing a formatted table. |
| [MkClassTable](https://phil65.github.io/mknodes/) | mknodes.templatenodes.mkclasstable | Node for a table showing info for a list of classes. |
| [MkNav](https://phil65.github.io/mknodes/) | mknodes.navs.mknav | Nav section, representing a nestable menu. |
<table>
<thead>
<tr>
<th>Class</th>
<th>Module</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://phil65.github.io/mknodes/">MkTable</a></td>
<td>mknodes.basenodes.mktable</td>
<td>Class representing a formatted table.</td>
</tr>
<tr>
<td><a href="https://phil65.github.io/mknodes/">MkClassTable</a></td>
<td>mknodes.templatenodes.mkclasstable</td>
<td>Node for a table showing info for a list of classes.</td>
</tr>
<tr>
<td><a href="https://phil65.github.io/mknodes/">MkNav</a></td>
<td>mknodes.navs.mknav</td>
<td>Nav section, representing a nestable menu.</td>
</tr>
</tbody>
</table>

Example: Extended layout

Jinja

{{ [_mk.MkTable, _mk.MkClassTable, _mk.MkNav] | MkClassTable(layout="default") }}

Python

MkClassTable([MkTable, MkClassTable, MkNav])
Name Children Inherits
MkTable
mknodes.basenodes.mktable
Class representing a formatted table.
    MkClassTable
    mknodes.templatenodes.mkclasstable
    Node for a table showing info for a list of classes.
      MkNav
      mknodes.navs.mknav
      Nav section, representing a nestable menu.
      | Name | Children | Inherits |
      |--- | --- | --- |
      | **<font size='4'>[MkTable](https://phil65.github.io/mknodes/)</font>**<br>*<font size='1'>mknodes.basenodes.mktable</font>*<br>Class representing a formatted table\. | <ul></ul> | <ul><li>[MkBaseTable](https://phil65.github.io/mknodes/)</li></ul> |
      | **<font size='4'>[MkClassTable](https://phil65.github.io/mknodes/)</font>**<br>*<font size='1'>mknodes.templatenodes.mkclasstable</font>*<br>Node for a table showing info for a list of classes\. | <ul></ul> | <ul><li>[MkTemplateTable](https://phil65.github.io/mknodes/)</li></ul> |
      | **<font size='4'>[MkNav](https://phil65.github.io/mknodes/)</font>**<br>*<font size='1'>mknodes.navs.mknav</font>*<br>Nav section, representing a nestable menu\. | <ul><li>[MkDoc](https://phil65.github.io/mknodes/)</li><li>[MkDefaultWebsite](https://phil65.github.io/mkdocs-mknodes/)</li></ul> | <ul><li>[MkNode](https://phil65.github.io/mknodes/)</li></ul> |
      
      <table>
      <thead>
      <tr>
      <th>Name</th>
      <th>Children</th>
      <th>Inherits</th>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td><strong><font size='4'><a href="https://phil65.github.io/mknodes/">MkTable</a></font></strong><br><em><font size='1'>mknodes.basenodes.mktable</font></em><br>Class representing a formatted table.</td>
      <td><ul></ul></td>
      <td><ul><li><a href="https://phil65.github.io/mknodes/">MkBaseTable</a></li></ul></td>
      </tr>
      <tr>
      <td><strong><font size='4'><a href="https://phil65.github.io/mknodes/">MkClassTable</a></font></strong><br><em><font size='1'>mknodes.templatenodes.mkclasstable</font></em><br>Node for a table showing info for a list of classes.</td>
      <td><ul></ul></td>
      <td><ul><li><a href="https://phil65.github.io/mknodes/">MkTemplateTable</a></li></ul></td>
      </tr>
      <tr>
      <td><strong><font size='4'><a href="https://phil65.github.io/mknodes/">MkNav</a></font></strong><br><em><font size='1'>mknodes.navs.mknav</font></em><br>Nav section, representing a nestable menu.</td>
      <td><ul><li><a href="https://phil65.github.io/mknodes/">MkDoc</a></li><li><a href="https://phil65.github.io/mkdocs-mknodes/">MkDefaultWebsite</a></li></ul></td>
      <td><ul><li><a href="https://phil65.github.io/mknodes/">MkNode</a></li></ul></td>
      </tr>
      </tbody>
      </table>
      

      Bases: MkTemplateTable

      Name Children Inherits
      MkTemplateTable
      mknodes.templatenodes.mktemplatetable
      Node for a table showing dependencies for a package.
      graph TD
        94721311991664["mkclasstable.MkClassTable"]
        94721312206496["mktemplatetable.MkTemplateTable"]
        94721308848336["mknode.MkNode"]
        94721311766592["node.Node"]
        140564252373184["builtins.object"]
        94721312206496 --> 94721311991664
        94721308848336 --> 94721312206496
        94721311766592 --> 94721308848336
        140564252373184 --> 94721311766592
      /home/runner/work/mknodes/mknodes/mknodes/templatenodes/mkclasstable/metadata.toml
      [metadata]
      icon = "octicon:table-24"
      name = "MkClassTable"
      
      [requirements.extension.tables]
      
      [examples.compact]
      title = "Compact layout"
      jinja = """
      {{ [_mk.MkTable, _mk.MkClassTable, _mk.MkNav] | MkClassTable(layout="compact") }}
      """
      
      [examples.extended]
      title = "Extended layout"
      jinja = """
      {{ [_mk.MkTable, _mk.MkClassTable, _mk.MkNav] | MkClassTable(layout="default") }}
      """
      
      [layouts.compact]
      Class = """
      {{ kls | get_link }}
      """
      Module = """
      {{ kls.__module__ }}
      """
      Description = """
      {{ kls | get_doc(only_summary=True) }}
      """
      
      [layouts.default]
      Name = """
      {{ kls | get_link | md_style(size=4, bold=True) }}<br>{{ kls.__module__ | md_style(size=1, italic=True) }}<br>{{ kls | get_doc(escape=True, only_summary=True) }}
      """
      Children = """
      <ul>{% for sub in kls | list_subclasses(recursive=False) %}
      <li>{{ sub | get_link }}</li>{% if loop.index > 10 %}<li>...</li>{% break %}{% endif %}{% endfor %}</ul>
      """
      Inherits = """
      <ul>{% for base_kls in kls | list_baseclasses(recursive=False) %}
      <li>{{ base_kls | get_link }}</li>{% if loop.index > 10 %}    <li>...</li>{% break %}{% endif %}{% endfor %}</ul>
      """
      
      mknodes.templatenodes.mkclasstable.MkClassTable
      class MkClassTable(mktemplatetable.MkTemplateTable):
          """Node for a table showing info for a list of classes."""
      
          def __init__(
              self,
              klasses: Sequence[type | str | griffe.Class],
              *,
              layout: str = "default",
              **kwargs,
          ):
              self.klasses = klasses
              super().__init__(layout=layout, **kwargs)
      
          def iter_items(self):
              for kls in self.klasses:
                  match kls:
                      case type():
                          yield dict(kls=kls, griffe_kls=grifferegistry.get_class(kls))
                      case griffe.Class():
                          yield dict(kls=classhelpers.import_module(kls.path), griffe_kls=kls)
                      case str():
                          yield dict(
                              kls=classhelpers.import_module(kls),
                              griffe_kls=grifferegistry.get_class(kls),
                          )